<?php defined('SEJUJOPEFDNGJSL') or exit('Access denied');?>
<div class="">
	<?php require("topbut.php") ?>
	<div class="panel panel-inverse">
        <div class="panel-heading">
            <h4 class="panel-title">渠道奖</h4>
        </div>
        <div class="panel-body">
        	<div class="table-responsive">
	        	<table border="0" cellpadding="0" cellspacing="0" style="margin:0 auto;" class="table table-striped givetable" align="center" >
					  <tbody>
						<tr>
							<th>序号</th>
							<th>类型</th>
							<th>积分</th>
							<th>交易时间</th>
							<th>所属订单号</th>
							<th>备注</th>
						</tr>
						<?php
							$xuhao=0;
							 $pagecount=10;
                             $condition=" where uid='".$_userid."'  and prize_option = 55  ";
                             $psql="select count(0) from ld_prize_list $condition";
                             $db->query($psql,3);
                             $pcount=$db->fval;
                             $pagecount=$pagecount;   //每页条数
                             $astr="&lsact=qdlist";    //Url
                             $pagearr=pagelist($pagecount,$pcount,$astr);
                             $offset=$pagearr[1];

							$db->query("select * from ld_prize_list   where prize_option = 55  and uid = ".$_userid." order by id desc limit $offset,$pagecount");
						    $combine_arr=$db->rs;
							if(!empty($combine_arr)){
								foreach($combine_arr as $k=> $v){
									$xuhao++;
									$give_help_info = give_get_help('give',$v['help_id'],'','');
									$give_help_no = $give_help_info['give_help_no'];
									$bianhao = substr($give_help_no,-14);
									if($v['prize_status']==1){
										$yanse="<font color='green'>";
										$des="已转入";
									}else{
										$yanse="<font color='red'>";
										$des="冻结";
									}
							?>
								<tr>
									<td><?php echo $xuhao; ?></td>
									<td>渠道奖</td>
									<td ><?php echo $yanse.$v['amount']; ?></font></td>
									<td><?php echo date("Y-m-d H:i:s",$v['prize_ltime']); ?></td>
									<td><a style="color:blue;" href="javascript:;" onclick="showfellow('<?php echo $give_help_no; ?>');"><?php echo "T".encorder($bianhao); ?></a></td>
									<td><?php echo $des; ?></td>
								</tr>
							<?php
								}
							}
							?>
					</tbody>
				</table>
			</div>
           <?php if(($pcount/$pagecount)>1){?>
           <div class="pagediv"><?php echo $pagearr[0]?></div>
           <?php }?>
           <?php if($pcount==0){?>
           <div class="pagediv" style="text-align:center;color:#E47501">--> 暂无数据</div>

           <?php
           }

           ?>
           <?php
           // echo "冻结1代领导奖:".$r['fir_freezedldj'];echo "&nbsp&nbsp冻结2代领导奖:".$r['sec_freezedldj'];echo "&nbsp&nbsp冻结4代领导奖:".$r['four_freezedldj'];
           ?>
        </div>
    </div>
</div>
<div class="layer_fellow" style="display: none;">
	<div style="margin-top:20px;" id="helper_nick_name"></div>
	<div id="helper_account"></div>
	<div id="bill_amount"></div>
	<div id="contact_phone"></div>
</div>
<div class="djglj" style="display: none;">
	<div class="djgljframe">
		<table>
			<tbody>
				<tr><th width=150>昵称</th><th width=80>用户帮助金额</th><th width=120>订单编号</th><th width='80'>推荐金额</th><th width=120>备注</th></tr>
	<?php
	$db->query("select *,SUM(amount) as samount from ld_prize_list where prize_option = 52 and lx_generation > 1 and uid = ".$_userid." and prize_status = 0 group by help_id");
	$prize_list = $db->rs;
	if(!empty($prize_list)){
		foreach($prize_list as $k=>$v){
			$the_give_help = give_get_help('give',$v['help_id'],'','');
			$order_no = $the_give_help['give_help_no'];
			$give_helper = $member->getuserinfo($the_give_help['uid']);
			if(strstr($v['description'],"，")){
				$description_arr = explode("，",$v['description']);
				$description_txt = $description[1];
			}else{
				$description_txt = '';
			}
			if($give_helper['is_freezed'] == 0){
	?>

			<tr>
				<td><?php echo $give_helper['nick_name']; ?></td>
				<td><?php echo $the_give_help['amount'] ?></td>
				<td><?php echo get_help_no("give",$the_give_help['uname'],$order_no); ?></td>
				<td><?php echo $v['samount']; ?></td>
				<td><?php echo !empty($description_txt) ? "（".$description_txt."）" : "" ?></td>
			</tr>
	<?php
			}
		}
	}
	?>
			</tbody>
		</table>
	</div>
</div>
<script type="text/javascript" src="theme/js/layer/layer.js"></script>
<script type="text/javascript">
	function showfellow(order_no){
		$.ajax({
			type: "post",
			url: "ajax.php?act=give_help_detail",
			dataType: "json",
			data:{"order_no":order_no},
			success: function(data){
				if (data.status) {
					$("#helper_nick_name").html("用户昵称："+data.nick_name);
					$("#helper_account").html("用户账号："+data.give_help_uname);
					$("#bill_amount").html("订单金额："+data.give_help_amount);
					$("#contact_phone").html("联系电话："+data.contact_phone);
				} else {
					alert(data.mes);
				}
			},
			error: function(){}
		});
		layer.open({
			type: 1,
			title: ['相关订单', 'font-size:14px;background-color:#b5c0c7;color:#fff;'],
			area: ['575px', '305px'],
			closeBtn: 1, //不显示关闭按钮
			shift: 2,
			shade:0,
			shadeClose: true, //开启遮罩关闭
			content: $('.layer_fellow')
		});
		return false;
	}
	function showdj(){
		layer.open({
			type: 1,
			title: ['领导奖（冻结）', 'font-size:14px;background-color:#b5c0c7;color:#fff;'],
			area: ['575px', '480px'],
			closeBtn: 1, //不显示关闭按钮
			shift: 2,
			shade:0,
			shadeClose: true, //开启遮罩关闭
			offset:['100px','10px'],
			scrollbar:true,
			content: $('.djglj')
		});
		return false;
	}
</script>